package com.bootdo.system.controller;

import com.bootdo.common.utils.R;
import com.bootdo.system.domain.DyMember;
import com.bootdo.system.service.DyMemberService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @create 2021-02-28 01-10
 */
@Api(description = "电影分成比例")
@Controller
@RequestMapping("/dyMemeber")
public class DyMemberController {

    @Autowired
    private DyMemberService memberService;

    @GetMapping("/list")
    @ResponseBody
    public List<DyMember> selectDyMemberList(String appId){
        return memberService.selectDyMemberList(appId);
    }

    @PostMapping("/add")
    @ResponseBody
    public R addDyMember(DyMember dyMember){
        dyMember.setCreateTime(LocalDateTime.now().toString());
        return memberService.addDyMemeber(dyMember);
    }

    @PostMapping("/update")
    @ResponseBody
    public R updateDyMember(DyMember dyMember){

        return memberService.updateMember(dyMember);
    }

}
